home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / education / pe103.dms / pe103.adf / autoexec.AMOS / autoexec.amosSourceCode next >
AMOS Source Code  |  1991-07-30  |  9KB  |  264 lines

  1. 'LEARN IN SPACE by Andy Paul--22 CEYLON PLACE, EASTBOURNE ,EAST SUSSEX,BN21 3JF  
  2. 'If you feel that you would like to improve the graphical/sound side of this 
  3. 'program then feel free,then re-distribute as ver 1.1,but please let me know 
  4. 'about it,plus i'd like to see your improvements.............
  5. Screen Open 0,320,256,16,Lowres : Cls 0
  6. YEP=False
  7. CHOOSE:
  8. Screen Open 1,320,256,16,Lowres
  9. Show 
  10. Load Iff "pics/menu1.iff" : Flash Off 
  11. Rem reserve space for 4 zones
  12. Reserve Zone 4
  13. Rem set them 
  14. Set Zone 1,90,102 To 226,125
  15. Set Zone 2,90,134 To 226,158
  16. Set Zone 3,90,164 To 226,188
  17. Set Zone 4,90,198 To 226,222
  18. OOPS:
  19. Repeat 
  20. Until Mouse Key<>0
  21. Rem check for which zone was chosen
  22. X=Hzone(X Mouse,Y Mouse)
  23. If X=1 Then ZZ=1 : YEP=True
  24. If X=2 Then ZZ=2 : YEP=True
  25. If X=3 and YEP=True Then Run "menu.amos"
  26. If X=3 and YEP=False Then Screen Open 2,320,25,16,Lowres : Cls 6 : Paper 6 : Print "  YOU MUST ADD or SUBTRACT BEFORE YOU                CAN PLAY" : Wait 200 : Screen Close 2 : Gosub OOPS
  27. If X=4 Then Gosub HELP
  28. If X=0 Then Gosub OOPS
  29. Load "bobs/maths.abk"
  30. Screen Close 1
  31. Hide 
  32. Load Iff "pics/numbers.iff"
  33. Get Sprite Palette 
  34. Curs Off : Flash Off : Hide : Paper 11
  35. Double Buffer 
  36. Dim V(16,2)
  37. Gosub VECTORS
  38. Noise To 15
  39. MAIN:
  40. Rem set up all the relevant values 
  41. POS=1 : SP#=0 : IB=1 : IC=22 : WRONG=0 : YES=0
  42. XB=160 : Y#=128
  43. VX#=0 : VY#=0
  44. PC=0 : PD=2
  45. SP#=0.1 : Rem  acceleration speed  
  46. D#=0.99 : Rem  deceleration / drag rate  
  47. Rem  Use D#=0 to simulate the vacuum of space (!?) 
  48. G#=0.05 : Rem   gravity  
  49. BF#=0.5 : Rem  bounce factor 
  50. NXT=1
  51. Rem put the balls with numbers in at their places
  52. Gosub NUMBERS
  53. '
  54. Gosub QUESTION
  55. Do 
  56.    If Fire(1) Then Gosub ISITRIGHT
  57.    If Jright(1) Then Add IB,1,1 To 5 : Inc XB : Inc XB
  58.    If PC=PD Then PC=0
  59.    If Jleft(1) Then Add IB,1,6 To 10 : Dec XB : Dec XB
  60.    If PC=PD Then PC=0
  61.    If Jup(1) Then VX#=VX#+V(POS,1)*SP# : VY#=VY#+V(POS,2)*SP# : Play 20,1
  62.    OX#=X# : OY#=Y#
  63.    X#=X#+VX#
  64.    Y#=Y#+VY#
  65.    VY#=VY#+G#
  66.    VX#=VX#*D# : VY#=VY#*D#
  67.    If X#>320 Then X#=-20
  68.    If X#<-20 Then X#=320
  69.    ' next bit does the bounce:
  70.    If Y#>165 Then Y#=165 : VY#=VY#*-BF#
  71.    If Y#<13 Then Y#=13 : VY#=-VY# : VX#=-VX#
  72.     Bob 10,XB,Y#,IB
  73.    If Bob Col(10,1 To 9) Then Gosub GOTNUM
  74.    'if you erase the next line,the bear goes TOO fast ! ! 
  75.    Wait Vbl 
  76. Loop 
  77. '
  78. VECTORS:
  79. For N=1 To 16
  80.    Read V(N,1),V(N,2)
  81. Next 
  82. Return 
  83. Data 0,-2,1,-2,2,-2,2,-1,2,0
  84. Data 2,1,2,2,1,2,0,2
  85. Data -1,2,-2,2,-2,1,-2,0
  86. Data -2,-1,-2,-2,-1,-2
  87. Rem this sub places the numbers
  88. NUMBERS:
  89. Pen 1
  90. Locate 22,28 : Print "CORRECT  0 "
  91. Pen 10
  92. Locate 22,30 : Print "WRONG    0 "
  93. BX=80
  94. For A=11 To 16
  95. Bob A,BX,198,22
  96. BX=BX+10
  97. Next A
  98. BX=170
  99. For A=17 To 22
  100. Bob A,BX,198,22
  101. BX=BX+10
  102. Next A
  103. Rem the next two lines decide on a + sign or - 
  104. If ZZ=1 Then Bob 23,150,198,11
  105. If ZZ=2 Then Bob 23,150,198,12
  106. Rem the next 3 lines places bobs 1 to 5 in a row 
  107. For A=1 To 5
  108. Bob A,A*50,20,A+12
  109. Next A
  110. Rem this does the bottom row 
  111. Bob 6,60,80,18 : Bob 7,120,80,19 : Bob 8,180,80,20 : Bob 9,240,80,21
  112. Return 
  113. GOTNUM:
  114. For B=1 To 9
  115. If Col(B) Then Locate 14,29 : Print B : Y#=Y#+40 : Return 
  116. Next B
  117. Return 
  118. QUESTION:
  119. Pen 4
  120. Rem if zz=2 means if the user chose subtract 
  121. Rem A=the answer it should be
  122. Rem BL=says how many balls on the left should be shown 
  123. Rem BR=as above but the right side 
  124. If ZZ=2 Then Gosub TAKEAWAY : Return 
  125. If NXT=1 Then Locate 5,29 : Print "1 + 1 =    " : A=2 : BL=1 : BR=1 : Gosub BALL
  126. If NXT=2 Then Locate 5,29 : Print "2 + 1 =    " : A=3 : BL=2 : BR=1 : Gosub BALL
  127. If NXT=3 Then Locate 5,29 : Print "3 + 2 =    " : A=5 : BL=3 : BR=2 : Gosub BALL
  128. If NXT=4 Then Locate 5,29 : Print "3 + 3 =    " : A=6 : BL=3 : BR=3 : Gosub BALL
  129. If NXT=5 Then Locate 5,29 : Print "5 + 3 =    " : A=8 : BL=5 : BR=3 : Gosub BALL
  130. If NXT=6 Then Locate 5,29 : Print "4 + 4 =    " : A=8 : BL=4 : BR=4 : Gosub BALL
  131. If NXT=7 Then Locate 5,29 : Print "6 + 1 =    " : A=7 : BL=6 : BR=1 : Gosub BALL
  132. If NXT=8 Then Locate 5,29 : Print "3 + 1 =    " : A=4 : BL=3 : BR=1 : Gosub BALL
  133. If NXT=9 Then Locate 5,29 : Print "2 + 6 =    " : A=8 : BL=2 : BR=6 : Gosub BALL
  134. If NXT=10 Then Locate 5,29 : Print "3 + 6 =    " : A=9 : BL=3 : BR=6 : Gosub BALL
  135. If NXT=11 Then Locate 5,29 : Print "3 + 4 =    " : A=7 : BL=3 : BR=4 : Gosub BALL
  136. If NXT=12 Then Locate 5,29 : Print "2 + 3 =    " : A=5 : BL=2 : BR=3 : Gosub BALL
  137. If NXT=13 Then Locate 5,29 : Print "2 + 5 =    " : A=7 : BL=2 : BR=5 : Gosub BALL
  138. If NXT=14 Then Locate 5,29 : Print "1 + 6 =    " : A=7 : BL=1 : BR=6 : Gosub BALL
  139. If NXT=15 Then Locate 5,29 : Print "1 + 4 =    " : A=5 : BL=1 : BR=4 : Gosub BALL
  140. If NXT=16 Then Gosub AGAIN
  141. Return 
  142. TAKEAWAY:
  143.   If NXT=1 Then Locate 5,29 : Print "3 - 1 =    " : A=2 : BL=3 : BR=1 : Gosub BALL
  144.   If NXT=2 Then Locate 5,29 : Print "4 - 1 =    " : A=3 : BL=4 : BR=1 : Gosub BALL
  145.   If NXT=3 Then Locate 5,29 : Print "5 - 2 =    " : A=3 : BL=5 : BR=2 : Gosub BALL
  146.   If NXT=4 Then Locate 5,29 : Print "6 - 3 =    " : A=3 : BL=6 : BR=3 : Gosub BALL
  147.   If NXT=5 Then Locate 5,29 : Print "6 - 1 =    " : A=5 : BL=6 : BR=1 : Gosub BALL
  148.   If NXT=6 Then Locate 5,29 : Print "6 - 3 =    " : A=3 : BL=6 : BR=3 : Gosub BALL
  149.   If NXT=7 Then Locate 5,29 : Print "5 - 1 =    " : A=4 : BL=5 : BR=1 : Gosub BALL
  150.   If NXT=8 Then Locate 5,29 : Print "5 - 4 =    " : A=1 : BL=5 : BR=4 : Gosub BALL
  151.   If NXT=9 Then Locate 5,29 : Print "5 - 3 =    " : A=2 : BL=5 : BR=3 : Gosub BALL
  152.   If NXT=10 Then Locate 5,29 : Print "4 - 1 =    " : A=3 : BL=4 : BR=1 : Gosub BALL
  153.   If NXT=11 Then Locate 5,29 : Print "6 - 1 =    " : A=5 : BL=6 : BR=1 : Gosub BALL
  154.   If NXT=12 Then Locate 5,29 : Print "5 - 3 =    " : A=2 : BL=5 : BR=3 : Gosub BALL
  155.   If NXT=13 Then Locate 5,29 : Print "6 - 4 =    " : A=2 : BL=6 : BR=4 : Gosub BALL
  156.   If NXT=14 Then Locate 5,29 : Print "6 - 3 =    " : A=3 : BL=6 : BR=3 : Gosub BALL
  157.   If NXT=15 Then Locate 5,29 : Print "4 - 2 =    " : A=2 : BL=4 : BR=2 : Gosub BALL
  158.   If NXT=16 Then Gosub AGAIN
  159. Return 
  160. ISITRIGHT:
  161. Rem if a+b don't match then it was wrong 
  162. If A<>B Then Boom : Inc WRONG : Locate 30,30 : Pen 10 : Print WRONG : Return 
  163. If A=B Then Inc YES : Locate 30,28 : Pen 1 : Print YES
  164.  Bell 
  165.  Inc NXT
  166. For BB=11 To 22
  167. Bob BB,,,22
  168. Next BB
  169. Gosub QUESTION
  170. Return 
  171. BALL:
  172. Rem yeah yeah,i used goto,it seemed nice and easy,and it works fine..... 
  173. If BL=6 Then Goto 10
  174. If BL=5 Then Goto 11
  175. If BL=4 Then Goto 12
  176. If BL=3 Then Goto 13
  177. If BL=2 Then Goto 14
  178. If BL=1 Then Goto 15
  179. 10 Bob 11,,,23
  180. 11 Bob 12,,,23
  181. 12 Bob 13,,,23
  182. 13 Bob 14,,,23
  183. 14 Bob 15,,,23
  184. 15 Bob 16,,,23
  185. If BR=6 Then Goto 16
  186. If BR=5 Then Goto 17
  187. If BR=4 Then Goto 18
  188. If BR=3 Then Goto 19
  189. If BR=2 Then Goto 20
  190. If BR=1 Then Goto 21
  191. 16 Bob 22,,,23
  192. 17 Bob 21,,,23
  193. 18 Bob 20,,,23
  194. 19 Bob 19,,,23
  195. 20 Bob 18,,,23
  196. 21 Bob 17,,,23
  197. Wait Vbl 
  198. Return 
  199. AGAIN:
  200. Screen Open 1,320,50,16,Lowres : Cls 7
  201. Paper 7
  202. Print ""
  203. Centre "END OF TEST"
  204. Print ""
  205. Print "           CORRECT ANSWERS = ";YES
  206. Print "           WRONG ANSWERS   = ";WRONG
  207. Print ""
  208. Centre "WOULD YOU LIKE TO PLAY AGAIN ?...Y/N"
  209. Wait Key 
  210. If Key State(21) Then Screen Close 1 : Gosub MAIN
  211. Screen Close 1 : Gosub CHOOSE
  212. HELP:
  213. Screen Open 2,620,256,16,Hires : Curs Off : Flash Off : Cls 0
  214. Paper 0
  215. Centre "HELP SCREEN"
  216. Print ""
  217. Print ""
  218. Pen 5
  219. Print "              LEARN IN SPACE v1.0      BY ANDY PAUL USING AMOS"
  220. Pen 7
  221. Print "                                                                           "
  222. Print "This program is shareware,if you use this program more than twice,then"
  223. Print "please send me a donation of ï¿½2,(not ï¿½20,not ï¿½10,just ï¿½2.....) thank you."
  224. Print "This disk may be copied freely as long as no profit is made to the person/s"
  225. Print "copying the disk."
  226. Locate 0,12 : Pen 10
  227. Print "INSTRUCTIONS:"
  228. Print ""
  229. Print "At the bottom of the screen you will be asked a sum,you must make the space"
  230. Print "bear hit the number which is correct with the use of the joystick.When you"
  231. Print "hit the number it will be printed on the screen.If this number is not the"
  232. Print "right choice then just go to the right one."
  233. Print ""
  234. Print "When you have the correct answer then press the fire button."
  235. Print ""
  236. Print "The program speaks for itself from then on......have fun"
  237. Print ""
  238. Print ""
  239. Pen 12
  240. Print "This program was written with very young children in mind,so obviously you"
  241. Print "will have to explain how to use,once told,there shouldn't be any need to "
  242. Print "expain again."
  243. Pen 2
  244. Print ""
  245. Print ""
  246. Centre "PRESS ANY KEY........."
  247. Clear Key : Wait Key 
  248. Print ""
  249. Print ""
  250. Print ""
  251. Print ""
  252. Print ""
  253. Pen 2
  254. Print "                                ANDY PAUL"
  255. Print "                                22 CEYLON PLACE"
  256. Print "                                EASTBOURNE"
  257. Print "                                EAST SUSSEX"
  258. Print "                                BN21 3JF"
  259. Print ""
  260. Clear Key : Wait Key 
  261. Fade 5
  262. Wait 100
  263. Screen Close 2
  264. Gosub CHOOSE